<?php
namespace common\rbac;

use yii\rbac\Rule;
/*** Checks if user role matches user passed via params  */ 
class AuthorRule extends Rule{     
	
	public $name = 'isAuthor';
	
	/**
	* @param string|integer $user the user ID.
	* @param Item $item the role or permission that this rule is associated with
	* @param array $params parameters passed to ManagerInterface::checkAccess().
	* @return boolean a value indicating whether the rule permits the role or permission it is associated with.
	*/
	public function execute($user, $item, $params){
		// var_dump($params);die;
		return isset($params['post']) ? $params['post'] == '123' : false;
	}
}